<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>专题列表 - 社交平台</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #3b82f6;
            --secondary: #8b5cf6;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --text-tertiary: #94a3b8;
            --bg-light: #f8fafc;
            --bg-white: #ffffff;
            --border-light: #e2e8f0;
            --radius: 12px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 70px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
            border-bottom: 1px solid var(--border-light);
        }
        
        .nav-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--text-primary);
            text-align: center;
            flex: 1;
        }
        
        .nav-btn {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 20px;
        }
        
        .nav-btn.primary {
            color: var(--primary);
        }
        
        /* 高级筛选容器 */
        .filter-container {
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            overflow: hidden;
        }
        
        /* 搜索框 */
        .search-group {
            position: relative;
            padding: 12px 16px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .search-input {
            width: 100%;
            padding: 12px 16px 12px 44px;
            border-radius: 24px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 14px;
            outline: none;
        }
        
        .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-tertiary);
            font-size: 18px;
        }
        
        /* 筛选标签栏 */
        .filter-tabs {
            display: flex;
            gap: 8px;
            overflow-x: auto;
            padding: 8px 16px;
            scrollbar-width: none;
        }
        
        .filter-tabs::-webkit-scrollbar {
            display: none;
        }
        
        .filter-tab {
            padding: 6px 14px;
            border-radius: 18px;
            font-size: 14px;
            white-space: nowrap;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .filter-tab.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 高级筛选下拉面板 */
        .advanced-filter {
            padding: 0 16px;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }
        
        .advanced-filter.show {
            max-height: 500px;
            padding: 16px;
        }
        
        .filter-section {
            margin-bottom: 16px;
        }
        
        .filter-section:last-child {
            margin-bottom: 0;
        }
        
        .filter-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .filter-options {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }
        
        .filter-checkbox {
            display: none;
        }
        
        .filter-checkbox + label {
            padding: 6px 12px;
            border-radius: 16px;
            font-size: 14px;
            border: 1px solid var(--border-light);
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .filter-checkbox:checked + label {
            border-color: var(--primary);
            background-color: rgba(59, 130, 246, 0.1);
            color: var(--primary);
        }
        
        /* 筛选展开/收起按钮 */
        .filter-toggle {
            width: 100%;
            padding: 12px;
            background: none;
            border: none;
            border-top: 1px solid var(--border-light);
            color: var(--primary);
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        
        /* 筛选结果标签 */
        .filter-chips {
            padding: 8px 16px;
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            background-color: rgba(59, 130, 246, 0.05);
            border-bottom: 1px solid var(--border-light);
        }
        
        .filter-chip {
            padding: 4px 10px;
            background-color: rgba(59, 130, 246, 0.1);
            border-radius: 12px;
            font-size: 13px;
            color: var(--primary);
            display: flex;
            align-items: center;
            gap: 6px;
        }
        
        .chip-remove {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background-color: rgba(59, 130, 246, 0.2);
            color: var(--primary);
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            cursor: pointer;
        }
        
        .clear-all {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 13px;
            margin-left: auto;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        /* 专题列表容器 */
        .topics-container {
            padding: 16px;
        }
        
        .topics-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }
        
        .topics-title {
            font-size: 16px;
            font-weight: 600;
        }
        
        .topics-count {
            color: var(--text-tertiary);
            font-size: 14px;
        }
        
        .sort-dropdown {
            background: none;
            border: none;
            color: var(--primary);
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        /* 专题卡片通用样式 */
        .topic-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            margin-bottom: 16px;
            overflow: hidden;
            transition: transform 0.2s ease;
        }
        
        .topic-card:hover {
            transform: translateY(-2px);
        }
        
        .topic-header {
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 10px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .topic-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .topic-creator {
            flex: 1;
        }
        
        .creator-name {
            font-size: 15px;
            font-weight: 600;
            margin-bottom: 2px;
        }
        
        .topic-time {
            font-size: 12px;
            color: var(--text-tertiary);
        }
        
        .topic-menu {
            color: var(--text-tertiary);
            background: none;
            border: none;
            font-size: 16px;
        }
        
        .topic-content {
            padding: 16px;
        }
        
        .topic-title {
            font-size: 17px;
            font-weight: 600;
            margin-bottom: 8px;
            line-height: 1.4;
        }
        
        .topic-description {
            font-size: 15px;
            color: var(--text-secondary);
            margin-bottom: 12px;
            line-height: 1.5;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        
        /* 专题类型标签 */
        .topic-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 12px;
        }
        
        .topic-tag {
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 12px;
            background-color: rgba(59, 130, 246, 0.1);
            color: var(--primary);
        }
        
        /* 无图专题样式 */
        .topic-no-image .topic-content {
            padding-bottom: 0;
        }
        
        /* 单图专题样式 */
        .topic-single-image .topic-image {
            width: 100%;
            border-radius: 8px;
            overflow: hidden;
            margin-bottom: 12px;
        }
        
        .topic-single-image .topic-image img {
            width: 100%;
            height: 180px;
            object-fit: cover;
        }
        
        /* 多图专题样式 */
        .topic-multi-image .topic-images {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 4px;
            border-radius: 8px;
            overflow: hidden;
            margin-bottom: 12px;
        }
        
        .topic-multi-image .topic-image {
            aspect-ratio: 1/1;
            overflow: hidden;
        }
        
        .topic-multi-image .topic-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        /* 专题底部信息 */
        .topic-footer {
            padding: 0 16px 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .topic-stats {
            display: flex;
            gap: 16px;
            font-size: 13px;
            color: var(--text-tertiary);
        }
        
        .topic-stat {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .topic-action {
            padding: 6px 14px;
            border-radius: 16px;
            font-size: 14px;
            font-weight: 500;
            border: 1px solid var(--primary);
            background-color: transparent;
            color: var(--primary);
        }
        
        .topic-action.joined {
            background-color: var(--primary);
            color: white;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 70px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: var(--text-tertiary);
            font-size: 11px;
            gap: 4px;
            text-decoration: none;
            flex: 1;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        .nav-icon {
            font-size: 22px;
        }
        
        /* 提示消息 */
        .toast {
            position: fixed;
            bottom: 90px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 6px;
            z-index: 9999;
            font-size: 14px;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast.show {
            opacity: 1;
        }
        
        /* 加载更多 */
        .load-more {
            width: 100%;
            padding: 12px;
            border-radius: 8px;
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            color: var(--text-primary);
            font-size: 15px;
            margin-top: 8px;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-btn" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">专题列表</div>
        <button class="nav-btn primary" id="createTopicBtn">
            <i class="fas fa-plus"></i>
        </button>
    </div>
    
    <!-- 筛选查询区域 -->
    <div class="filter-container">
        <!-- 搜索框 -->
        <div class="search-group">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索专题、标签或创建者...">
        </div>
        
        <!-- 快捷筛选标签 -->
        <div class="filter-tabs">
            <button class="filter-tab active">全部专题</button>
            <button class="filter-tab">热门推荐</button>
            <button class="filter-tab">最新发布</button>
            <button class="filter-tab">已加入</button>
        </div>
        
        <!-- 筛选结果标签 -->
        <div class="filter-chips" id="filterChips">
            <!-- 动态生成的筛选标签 -->
            <button class="clear-all" id="clearAllBtn" style="display: none;">
                <i class="fas fa-times"></i> 清除全部
            </button>
        </div>
        
        <!-- 高级筛选下拉面板 -->
        <div class="advanced-filter" id="advancedFilter">
            <!-- 分类筛选 -->
            <div class="filter-section">
                <div class="filter-title">
                    <i class="fas fa-th-large"></i> 专题分类
                </div>
                <div class="filter-options">
                    <input type="checkbox" id="cat1" class="filter-checkbox" data-type="category" data-value="生活">
                    <label for="cat1">生活</label>
                    
                    <input type="checkbox" id="cat2" class="filter-checkbox" data-type="category" data-value="科技">
                    <label for="cat2">科技</label>
                    
                    <input type="checkbox" id="cat3" class="filter-checkbox" data-type="category" data-value="娱乐">
                    <label for="cat3">娱乐</label>
                    
                    <input type="checkbox" id="cat4" class="filter-checkbox" data-type="category" data-value="旅行">
                    <label for="cat4">旅行</label>
                    
                    <input type="checkbox" id="cat5" class="filter-checkbox" data-type="category" data-value="美食">
                    <label for="cat5">美食</label>
                    
                    <input type="checkbox" id="cat6" class="filter-checkbox" data-type="category" data-value="读书">
                    <label for="cat6">读书</label>
                </div>
            </div>
            
            <!-- 内容类型筛选 -->
            <div class="filter-section">
                <div class="filter-title">
                    <i class="fas fa-image"></i> 内容类型
                </div>
                <div class="filter-options">
                    <input type="checkbox" id="type1" class="filter-checkbox" data-type="content" data-value="有图专题">
                    <label for="type1">有图专题</label>
                    
                    <input type="checkbox" id="type2" class="filter-checkbox" data-type="content" data-value="无图专题">
                    <label for="type2">无图专题</label>
                    
                    <input type="checkbox" id="type3" class="filter-checkbox" data-type="content" data-value="视频专题">
                    <label for="type3">视频专题</label>
                </div>
            </div>
            
            <!-- 成员数量筛选 -->
            <div class="filter-section">
                <div class="filter-title">
                    <i class="fas fa-users"></i> 成员数量
                </div>
                <div class="filter-options">
                    <input type="checkbox" id="mem1" class="filter-checkbox" data-type="members" data-value="100人以下">
                    <label for="mem1">100人以下</label>
                    
                    <input type="checkbox" id="mem2" class="filter-checkbox" data-type="members" data-value="100-1000人">
                    <label for="mem2">100-1000人</label>
                    
                    <input type="checkbox" id="mem3" class="filter-checkbox" data-type="members" data-value="1000人以上">
                    <label for="mem3">1000人以上</label>
                </div>
            </div>
            
            <!-- 时间筛选 -->
            <div class="filter-section">
                <div class="filter-title">
                    <i class="fas fa-calendar"></i> 创建时间
                </div>
                <div class="filter-options">
                    <input type="checkbox" id="time1" class="filter-checkbox" data-type="time" data-value="今天">
                    <label for="time1">今天</label>
                    
                    <input type="checkbox" id="time2" class="filter-checkbox" data-type="time" data-value="本周">
                    <label for="time2">本周</label>
                    
                    <input type="checkbox" id="time3" class="filter-checkbox" data-type="time" data-value="本月">
                    <label for="time3">本月</label>
                    
                    <input type="checkbox" id="time4" class="filter-checkbox" data-type="time" data-value="更早">
                    <label for="time4">更早</label>
                </div>
            </div>
        </div>
        
        <!-- 筛选展开/收起按钮 -->
        <button class="filter-toggle" id="filterToggle">
            <span>高级筛选</span>
            <i class="fas fa-chevron-down"></i>
        </button>
    </div>
    
    <!-- 专题列表 -->
    <div class="topics-container">
        <div class="topics-header">
            <div>
                <h2 class="topics-title">发现专题</h2>
                <span class="topics-count">找到 32 个专题</span>
            </div>
            <select class="sort-dropdown" id="sortDropdown">
                <option value="recommend">推荐排序</option>
                <option value="latest">最新发布</option>
                <option value="hot">热门优先</option>
                <option value="joined">参与人数</option>
            </select>
        </div>
        
        <!-- 多图专题 -->
        <div class="topic-card topic-multi-image" data-id="1" data-category="旅行" data-content="有图专题" data-members="1000人以上" data-time="本周">
            <div class="topic-header">
                <img src="https://picsum.photos/id/64/100/100" alt="创建者头像" class="topic-avatar">
                <div class="topic-creator">
                    <div class="creator-name">旅行摄影联盟</div>
                    <div class="topic-time">3天前 创建</div>
                </div>
                <button class="topic-menu">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            
            <div class="topic-content">
                <h3 class="topic-title">全球最美徒步路线大赏</h3>
                <p class="topic-description">收集全球最值得一去的徒步路线，分享徒步经验、装备清单和绝美风景，欢迎所有徒步爱好者加入交流。</p>
                
                <div class="topic-tags">
                    <span class="topic-tag">徒步</span>
                    <span class="topic-tag">旅行</span>
                    <span class="topic-tag">摄影</span>
                    <span class="topic-tag">户外</span>
                </div>
                
                <div class="topic-images">
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/29/300/300" alt="专题图片1">
                    </div>
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/30/300/300" alt="专题图片2">
                    </div>
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/31/300/300" alt="专题图片3">
                    </div>
                </div>
            </div>
            
            <div class="topic-footer">
                <div class="topic-stats">
                    <div class="topic-stat">
                        <i class="far fa-user"></i> 1.2k 成员
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-comment"></i> 356 讨论
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-image"></i> 892 图片
                    </div>
                </div>
                <button class="topic-action" data-topic="1">加入</button>
            </div>
        </div>
        
        <!-- 单图专题 -->
        <div class="topic-card topic-single-image" data-id="2" data-category="美食" data-content="有图专题" data-members="1000人以上" data-time="本月">
            <div class="topic-header">
                <img src="https://picsum.photos/id/65/100/100" alt="创建者头像" class="topic-avatar">
                <div class="topic-creator">
                    <div class="creator-name">美食探索家</div>
                    <div class="topic-time">1周前 创建</div>
                </div>
                <button class="topic-menu">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            
            <div class="topic-content">
                <h3 class="topic-title">城市隐藏美食地图</h3>
                <p class="topic-description">寻找城市里不为人知的美食小店，分享真实测评和推荐菜品，让我们一起探索舌尖上的惊喜。</p>
                
                <div class="topic-tags">
                    <span class="topic-tag">美食</span>
                    <span class="topic-tag">探店</span>
                    <span class="topic-tag">美食地图</span>
                </div>
                
                <div class="topic-image">
                    <img src="https://picsum.photos/id/42/600/300" alt="专题图片">
                </div>
            </div>
            
            <div class="topic-footer">
                <div class="topic-stats">
                    <div class="topic-stat">
                        <i class="far fa-user"></i> 2.5k 成员
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-comment"></i> 1.2k 讨论
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-image"></i> 3.7k 图片
                    </div>
                </div>
                <button class="topic-action joined" data-topic="2">已加入</button>
            </div>
        </div>
        
        <!-- 无图专题 -->
        <div class="topic-card topic-no-image" data-id="3" data-category="读书" data-content="无图专题" data-members="1000人以上" data-time="本月">
            <div class="topic-header">
                <img src="https://picsum.photos/id/66/100/100" alt="创建者头像" class="topic-avatar">
                <div class="topic-creator">
                    <div class="creator-name">读书俱乐部</div>
                    <div class="topic-time">2周前 创建</div>
                </div>
                <button class="topic-menu">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            
            <div class="topic-content">
                <h3 class="topic-title">2023年度好书推荐与分享</h3>
                <p class="topic-description">分享你今年读过的最佳书籍，写下书评和感悟，参与每月读书讨论，结识志同道合的书友。</p>
                
                <div class="topic-tags">
                    <span class="topic-tag">读书</span>
                    <span class="topic-tag">书评</span>
                    <span class="topic-tag">文学</span>
                    <span class="topic-tag">分享</span>
                </div>
            </div>
            
            <div class="topic-footer">
                <div class="topic-stats">
                    <div class="topic-stat">
                        <i class="far fa-user"></i> 3.8k 成员
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-comment"></i> 5.2k 讨论
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-book"></i> 1.5k 书籍
                    </div>
                </div>
                <button class="topic-action joined" data-topic="3">已加入</button>
            </div>
        </div>
        
        <!-- 多图专题 -->
        <div class="topic-card topic-multi-image" data-id="4" data-category="科技" data-content="有图专题" data-members="1000人以上" data-time="本周">
            <div class="topic-header">
                <img src="https://picsum.photos/id/67/100/100" alt="创建者头像" class="topic-avatar">
                <div class="topic-creator">
                    <div class="creator-name">数码科技控</div>
                    <div class="topic-time">4天前 创建</div>
                </div>
                <button class="topic-menu">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            
            <div class="topic-content">
                <h3 class="topic-title">2023年度数码产品评测汇总</h3>
                <p class="topic-description">各类数码产品的深度评测、横向对比和购买建议，帮助大家做出更明智的消费决策。</p>
                
                <div class="topic-tags">
                    <span class="topic-tag">数码</span>
                    <span class="topic-tag">评测</span>
                    <span class="topic-tag">科技</span>
                    <span class="topic-tag">推荐</span>
                </div>
                
                <div class="topic-images">
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/96/300/300" alt="专题图片1">
                    </div>
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/97/300/300" alt="专题图片2">
                    </div>
                    <div class="topic-image">
                        <img src="https://picsum.photos/id/98/300/300" alt="专题图片3">
                    </div>
                </div>
            </div>
            
            <div class="topic-footer">
                <div class="topic-stats">
                    <div class="topic-stat">
                        <i class="far fa-user"></i> 2.1k 成员
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-comment"></i> 876 讨论
                    </div>
                    <div class="topic-stat">
                        <i class="far fa-image"></i> 432 图片
                    </div>
                </div>
                <button class="topic-action" data-topic="4">加入</button>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <button class="load-more" id="loadMoreBtn">加载更多专题</button>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home nav-icon"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass nav-icon"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-thumbtack nav-icon"></i>
            <span>专题</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-bell nav-icon"></i>
            <span>通知</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user nav-icon"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- 提示消息 -->
    <div class="toast" id="toast"></div>
    
    <!-- 专题操作菜单 -->
    <div class="modal fade" id="topicMenuModal" tabindex="-1">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                <div class="modal-body p-0">
                    <button class="btn w-100 text-start px-4 py-3 border-0" style="font-size: 15px;">
                        <i class="fas fa-share-alt me-2"></i> 分享专题
                    </button>
                    <button class="btn w-100 text-start px-4 py-3 border-0" style="font-size: 15px;">
                        <i class="fas fa-bookmark me-2"></i> 收藏专题
                    </button>
                    <div class="dropdown-divider m-0"></div>
                    <button class="btn w-100 text-start px-4 py-3 border-0 text-danger" style="font-size: 15px;">
                        <i class="fas fa-flag me-2"></i> 举报专题
                    </button>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById('backBtn');
        const createTopicBtn = document.getElementById('createTopicBtn');
        const filterTabs = document.querySelectorAll('.filter-tab');
        const topicActions = document.querySelectorAll('.topic-action');
        const topicMenus = document.querySelectorAll('.topic-menu');
        const sortDropdown = document.getElementById('sortDropdown');
        const searchInput = document.querySelector('.search-input');
        const loadMoreBtn = document.getElementById('loadMoreBtn');
        const toast = document.getElementById('toast');
        const topicMenuModal = new bootstrap.Modal(document.getElementById('topicMenuModal'));
        const filterToggle = document.getElementById('filterToggle');
        const advancedFilter = document.getElementById('advancedFilter');
        const filterCheckboxes = document.querySelectorAll('.filter-checkbox');
        const filterChips = document.getElementById('filterChips');
        const clearAllBtn = document.getElementById('clearAllBtn');
        const topicCards = document.querySelectorAll('.topic-card');
        
        // 存储当前筛选条件
        let currentFilters = {
            category: [],
            content: [],
            members: [],
            time: [],
            tab: '全部专题'
        };
        
        // 显示提示消息
        function showToast(message) {
            toast.textContent = message;
            toast.classList.add('show');
            
            clearTimeout(toast.timeout);
            toast.timeout = setTimeout(() => {
                toast.classList.remove('show');
            }, 2000);
        }
        
        // 更新筛选标签
        function updateFilterChips() {
            // 清除现有标签（保留清除按钮）
            const chips = filterChips.querySelectorAll('.filter-chip');
            chips.forEach(chip => chip.remove());
            
            // 添加标签
            let hasFilters = false;
            
            // 添加快捷标签
            if (currentFilters.tab !== '全部专题') {
                addFilterChip('tab', currentFilters.tab);
                hasFilters = true;
            }
            
            // 添加高级筛选标签
            Object.keys(currentFilters).forEach(type => {
                if (type !== 'tab' && currentFilters[type].length > 0) {
                    currentFilters[type].forEach(value => {
                        addFilterChip(type, value);
                        hasFilters = true;
                    });
                }
            });
            
            // 显示/隐藏清除全部按钮
            clearAllBtn.style.display = hasFilters ? 'flex' : 'none';
            
            // 应用筛选
            applyFilters();
        }
        
        // 添加筛选标签
        function addFilterChip(type, value) {
            const chip = document.createElement('div');
            chip.className = 'filter-chip';
            chip.setAttribute('data-type', type);
            chip.setAttribute('data-value', value);
            
            let label = value;
            if (type === 'tab') {
                // 快捷标签特殊处理
                switch(value) {
                    case '热门推荐': label = '热门专题'; break;
                    case '最新发布': label = '最新专题'; break;
                    case '已加入': label = '我的专题'; break;
                }
            }
            
            chip.innerHTML = `
                <span>${label}</span>
                <button class="chip-remove"><i class="fas fa-times"></i></button>
            `;
            
            // 添加删除事件
            chip.querySelector('.chip-remove').addEventListener('click', function(e) {
                e.stopPropagation();
                removeFilter(type, value);
            });
            
            filterChips.insertBefore(chip, clearAllBtn);
        }
        
        // 添加筛选条件
        function addFilter(type, value) {
            if (!currentFilters[type].includes(value)) {
                currentFilters[type].push(value);
                updateFilterChips();
            }
        }
        
        // 移除筛选条件
        function removeFilter(type, value) {
            if (type === 'tab') {
                currentFilters.tab = '全部专题';
                // 更新快捷标签选中状态
                filterTabs.forEach(tab => {
                    if (tab.textContent === '全部专题') {
                        tab.classList.add('active');
                    } else {
                        tab.classList.remove('active');
                    }
                });
            } else {
                currentFilters[type] = currentFilters[type].filter(item => item !== value);
                // 更新复选框状态
                filterCheckboxes.forEach(checkbox => {
                    if (checkbox.getAttribute('data-type') === type && 
                        checkbox.getAttribute('data-value') === value) {
                        checkbox.checked = false;
                    }
                });
            }
            
            updateFilterChips();
        }
        
        // 清除所有筛选条件
        function clearAllFilters() {
            // 重置筛选对象
            currentFilters = {
                category: [],
                content: [],
                members: [],
                time: [],
                tab: '全部专题'
            };
            
            // 重置UI
            filterTabs.forEach(tab => {
                if (tab.textContent === '全部专题') {
                    tab.classList.add('active');
                } else {
                    tab.classList.remove('active');
                }
            });
            
            filterCheckboxes.forEach(checkbox => {
                checkbox.checked = false;
            });
            
            updateFilterChips();
            showToast('已清除全部筛选条件');
        }
        
        // 应用筛选条件
        function applyFilters() {
            let visibleCount = 0;
            
            topicCards.forEach(card => {
                let isVisible = true;
                
                // 快捷标签筛选
                if (currentFilters.tab === '已加入') {
                    if (!card.querySelector('.topic-action').classList.contains('joined')) {
                        isVisible = false;
                    }
                }
                
                // 分类筛选
                if (currentFilters.category.length > 0) {
                    const cardCategory = card.getAttribute('data-category');
                    if (!currentFilters.category.includes(cardCategory)) {
                        isVisible = false;
                    }
                }
                
                // 内容类型筛选
                if (currentFilters.content.length > 0) {
                    const cardContent = card.getAttribute('data-content');
                    if (!currentFilters.content.includes(cardContent)) {
                        isVisible = false;
                    }
                }
                
                // 成员数量筛选
                if (currentFilters.members.length > 0) {
                    const cardMembers = card.getAttribute('data-members');
                    if (!currentFilters.members.includes(cardMembers)) {
                        isVisible = false;
                    }
                }
                
                // 时间筛选
                if (currentFilters.time.length > 0) {
                    const cardTime = card.getAttribute('data-time');
                    if (!currentFilters.time.includes(cardTime)) {
                        isVisible = false;
                    }
                }
                
                // 应用显示/隐藏
                card.style.display = isVisible ? 'block' : 'none';
                if (isVisible) visibleCount++;
            });
            
            // 更新计数
            document.querySelector('.topics-count').textContent = `找到 ${visibleCount} 个专题`;
        }
        
        // 绑定事件
        function bindEvents() {
            // 返回按钮
            backBtn.addEventListener('click', () => {
                history.back();
                showToast('返回上一页');
            });
            
            // 创建专题按钮
            createTopicBtn.addEventListener('click', () => {
                showToast('进入创建专题页面');
            });
            
            // 快捷筛选标签切换
            filterTabs.forEach(tab => {
                tab.addEventListener('click', function() {
                    const tabText = this.textContent;
                    filterTabs.forEach(t => t.classList.remove('active'));
                    this.classList.add('active');
                    
                    currentFilters.tab = tabText;
                    updateFilterChips();
                    showToast(`已筛选: ${tabText}`);
                });
            });
            
            // 搜索功能
            searchInput.addEventListener('keyup', function(e) {
                if (e.key === 'Enter') {
                    const searchText = this.value.trim();
                    if (searchText) {
                        showToast(`搜索专题: ${searchText}`);
                        // 实际应用中这里会触发搜索请求
                    }
                }
            });
            
            // 排序下拉框
            sortDropdown.addEventListener('change', function() {
                const sortType = this.options[this.selectedIndex].text;
                showToast(`已按${sortType}排序`);
                // 实际应用中这里会触发排序请求
            });
            
            // 专题操作菜单
            topicMenus.forEach(menu => {
                menu.addEventListener('click', function() {
                    const topicId = this.closest('.topic-card').getAttribute('data-id');
                    topicMenuModal.show();
                });
            });
            
            // 加入/退出专题
            topicActions.forEach(button => {
                button.addEventListener('click', function() {
                    const topicId = this.getAttribute('data-topic');
                    const topicCard = this.closest('.topic-card');
                    const memberStat = topicCard.querySelector('.topic-stat:first-child');
                    const currentMembers = parseInt(memberStat.textContent.replace(/[^0-9]/g, ''));
                    
                    if (this.classList.contains('joined')) {
                        this.classList.remove('joined');
                        this.textContent = '加入';
                        memberStat.innerHTML = `<i class="far fa-user"></i> ${currentMembers - 1} 成员`;
                        showToast('已退出专题');
                    } else {
                        this.classList.add('joined');
                        this.textContent = '已加入';
                        memberStat.innerHTML = `<i class="far fa-user"></i> ${currentMembers + 1} 成员`;
                        showToast('成功加入专题');
                    }
                    
                    // 如果当前筛选是"已加入"，需要重新应用筛选
                    if (currentFilters.tab === '已加入') {
                        applyFilters();
                    }
                });
            });
            
            // 加载更多
            loadMoreBtn.addEventListener('click', function() {
                this.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 加载中...';
                setTimeout(() => {
                    this.textContent = '加载更多专题';
                    showToast('已加载全部专题');
                }, 1500);
            });
            
            // 点击专题卡片进入详情
            document.querySelectorAll('.topic-card').forEach(card => {
                card.addEventListener('click', function(e) {
                    if (!e.target.closest('button')) {
                        const topicId = this.getAttribute('data-id');
                        showToast(`进入专题 #${topicId} 详情`);
                    }
                });
            });
            
            // 高级筛选展开/收起
            filterToggle.addEventListener('click', function() {
                const icon = this.querySelector('i');
                const text = this.querySelector('span');
                
                if (advancedFilter.classList.contains('show')) {
                    advancedFilter.classList.remove('show');
                    icon.classList.replace('fa-chevron-up', 'fa-chevron-down');
                    text.textContent = '高级筛选';
                } else {
                    advancedFilter.classList.add('show');
                    icon.classList.replace('fa-chevron-down', 'fa-chevron-up');
                    text.textContent = '收起筛选';
                }
            });
            
            // 高级筛选复选框
            filterCheckboxes.forEach(checkbox => {
                checkbox.addEventListener('change', function() {
                    const type = this.getAttribute('data-type');
                    const value = this.getAttribute('data-value');
                    
                    if (this.checked) {
                        addFilter(type, value);
                        showToast(`已筛选: ${value}`);
                    } else {
                        removeFilter(type, value);
                        showToast(`已取消筛选: ${value}`);
                    }
                });
            });
            
            // 清除全部筛选
            clearAllBtn.addEventListener('click', clearAllFilters);
        }
        
        // 初始化
        function init() {
            bindEvents();
            updateFilterChips();
        }
        
        // 启动
        init();
    </script>
</body>
</html>
